﻿using System;

namespace Silverlight
{
    /// <summary>
    /// DataSet event arguments
    /// </summary>
    public class DataSetEventArgs : EventArgs
    {
        #region Data Fields
        /// <summary>
        /// "Column" property data field
        /// </summary>
        private DataColumn _column;

        /// <summary>
        /// "ProposedValue" property data field
        /// </summary>
        private string _proposedValue;

        /// <summary>
        /// "RejectProposedValue" property data field
        /// </summary>
        private bool _rejected;

        /// <summary>
        /// "Row" property data field
        /// </summary>
        private DataRow _row;
        #endregion

        #region Constructors
        /// <summary>
        /// Default constructor
        /// </summary>
        internal DataSetEventArgs()
        {
        }

        /// <summary>
        /// Creates event arguments taking proposed value
        /// </summary>
        /// <param name="proposedValue">Proposed value</param>
        internal DataSetEventArgs(string proposedValue)
        {
            this._proposedValue = proposedValue;
        }
        #endregion

        #region Properties
        /// <summary>
        /// Gets or sets column with changes
        /// </summary>
        public DataColumn Column
        {
            get
            {
                return this._column;
            }
            set
            {
                // Validate argument
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }

                this._column = value;
            }
        }

        /// <summary>
        /// Gets or sets command for execution
        /// </summary>
        public string Command
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets proposed value
        /// </summary>
        public string ProposedValue
        {
            get
            {
                return this._proposedValue;
            }
            set
            {
                this._proposedValue = value;
            }
        }

        /// <summary>
        /// True for rejecting proposed value
        /// </summary>
        public bool Rejected
        {
            get
            {
                return this._rejected;
            }
            set
            {
                this._rejected = value;
            }
        }

        /// <summary>
        /// Gets or sets row with changes
        /// </summary>
        public DataRow Row
        {
            get
            {
                return this._row;
            }
            set
            {
                // Validate argument
                if (value == null)
                {
                    throw new ArgumentNullException("value");
                }

                this._row = value;
            }
        }
        #endregion
    }
}
